import * as React from "react";
import { Dimensions } from "react-native";
import { TabView, TabBar, SceneMap } from "react-native-tab-view";

export default class TabMenu extends React.Component {
  state = {
    index: 0,
    routes: []
  };

  render() {
    const {
      navigationState,
      tabBarPosition,
      sceneMap,
      layoutW,
      layoutH
    } = this.props;
    this.state = navigationState;
    return (
      <TabView
        navigationState={this.state}
        tabBarPosition={tabBarPosition || "bottom"}
        renderScene={SceneMap(sceneMap)}
        onIndexChange={index => this.setState({ index })}
        initialLayout={{
          width: layoutW || Dimensions.get("window").width,
          height: layoutH || Dimensions.get("window").height
        }}
      />
    );
  }
}
